﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using WebCommit.Common.Entitys;

namespace WebCommit.Common.Mvc.BaseClass
{
	public class BaseController:Controller
	{
		public UserEntity LoginUser
		{
			get {
				UserEntity user =  Session["LoginUser"] as UserEntity;
				return user;
			}
			set
			{
				Session["LoginUser"] = value;
			}
		}

		public ActionResult RedirectToLogin()
		{
			return RedirectToLogin(this.Request.RawUrl);
		}
		public ActionResult RedirectToLogin(string redirectUrl)
		{
			return this.RedirectToAction("Login", "UserVis", new { RedirectUrl = redirectUrl });
		}
		//public bool IsLogin
		//{
		//    get {
		//        if (Session["IsLogin"] == null)
		//        {
		//            LoginUser = null;
		//            return false;
		//        }

		//        return bool.Parse(Session["IsLogin"].ToString());
		//    }
		//    set
		//    {
		//        Session["IsLogin"] = false;
		//    }
		//}
	}
}
